﻿namespace EFS.RC.CC.Deployment.Tables.Tools
{
	public static class AgentSkills
	{
		/// GetByAgentID
		public static EFS.RC.CC.Deployment.Entities.Operators.Skills.Skill[] GetByAgentID(
			System.Int32 agentID)
		{
			// handle connection
			using (EFS.DB.Connection connection = EFS.RC.CC.Deployment.Connection.New1)
			{
				// get data
				return connection.DoExecuteTableReaderQuery<EFS.RC.CC.Deployment.Entities.Operators.Skills.Skill>(
					"[dbo].[AgentSkills_GetByAgentID]",
					new EFS.DB.Parameters.Array("agent_id", agentID),
					EFS.RC.CC.Deployment.Tables.DataRow.Operators.Skills.Skill.Load);
			}
		}

		/// Create
		public static void Create(
			System.Int32 agentID,
			System.Int32 skillID,
			System.Int32 skillValue,
			EFS.DB.Connection connection)
		{
			// check
			EFS.Common.Verify.Reference(connection, "connection");

			// get data
			connection.DoExecuteNonQuery(
				"[dbo].[AgentSkills_Create]",
				new EFS.DB.Parameters.Array(
					new System.String[] { "agent_id" , "skill_id", "skill_value"},
					new System.Object[] { agentID, skillID, skillValue }));
		}

		/// Delete
		public static void Delete(
			System.Int32 agentID,
			System.Int32 skillID)
		{
			// handle connection
			using (EFS.DB.Connection connection = EFS.RC.CC.Deployment.Connection.New1)
			{
				// get data
				connection.DoExecuteNonQuery(
					"[dbo].[AgentSkills_Delete]",
					new EFS.DB.Parameters.Array(
						new System.String[] { "agent_id", "skill_id" },
						new System.Object[] { agentID, skillID }));
			}
		}

		/// DeleteByAgentID
		public static void DeleteByAgentID(
			System.Int32 agentID,
			EFS.DB.Connection connection)
		{
			// check
			EFS.Common.Verify.Reference(connection, "connection");

			// get data
			connection.DoExecuteNonQuery(
				"[dbo].[AgentSkills_DeleteByAgentID]",
				new EFS.DB.Parameters.Array("agent_id", agentID));
		}
	}

}